package cn.iocoder.yudao.module.resource.api.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.StringArrayValuable;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

import java.util.Arrays;

@AllArgsConstructor
@ToString
public enum MessageVectorColumnEnum implements StringArrayValuable {
    V_USER_TEXT("vUserText", "向量-用户消息"),
    V_REPLY_TEXT("vReplyText", "向量-回复消息"),
    V_EXTRA1("vExtra1", "向量-额外1"),
    V_EXTRA2("vExtra2", "向量-额外2"),
    MESSAGE_ID("messageId", "消息id"),
    SENDER_TYPE("senderType", "发送者类型"),
    CONTENT_TYPE("contentType", "内容类型"),
    USER_TEXT("userText", "用户文本"),
    REPLY_TEXT("replyText", "回复文本"),
    AUDIO_DATA("audioData", "音频数据"),
    ROLE_ID("roleId", "角色id"),
    CREATE_TIME("createTime", "创建时间"),
    EXTENSION_STR1("extension_str1", "扩展字符串1"),
    EXTENSION_STR2("extension_str2", "扩展字符串2"),
    EXTENSION_STR3("extension_str3", "扩展字符串3"),
    EXTENSION_INT1("extension_int1", "扩展整型1"),
    EXTENSION_INT2("extension_int2", "扩展整型2"),
    EXTENSION_INT3("extension_int3", "扩展整型3"),
    EXTENSION_LONG1("extension_long1", "扩展长整型1"),
    EXTENSION_LONG2("extension_long2", "扩展长整型2"),
    EXTENSION_LONG3("extension_long3", "扩展长整型3"),
    EXTENSION_FLOAT1("extension_float1", "扩展浮点型1"),
    EXTENSION_FLOAT2("extension_float2", "扩展浮点型2"),  // 注意: 原字段名可能是拼写错误(floa2)
    EXTENSION_FLOAT3("extension_float3", "扩展浮点型3");  // 注意: 原字段名可能是拼写错误(floa3)
    ;

    public static final String[] ARRAYS = Arrays.stream(values())
            .map(MessageVectorColumnEnum::getValue)
            .toArray(String[]::new);

    /**
     * 类型
     */
    private final String value;
    /**
     * 类型名
     */
    private final String name;

    public static MessageVectorColumnEnum valueOf(Integer value) {

        return ArrayUtil.firstMatch(userType -> userType.getValue().equals(value), MessageVectorColumnEnum.values());
    }

    @Override
    public String[] array() {
        return ARRAYS;
    }

    @JsonValue
    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }
}
